From: Jonas Dreßler Date: Mon, 1 Mar 2021 09:07:27 +0000 (+0100) Subject: panel: Only update appMenu icon when the app actually changed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~157 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5de9166f7a2c0bc8e3347492bb33dac894bb0323;p=gnome-shell.git panel: Only update appMenu icon when the app actually changed Right now we always recreate the icon of the appMenu when calling _sync(). This will relayout the panel everytime we open the overview, because we call _sync() in that case. We can easily avoid that by only recreating the icon actor in case the app that's opened actually changes. This gets us close to doing no more relayouts of the panel when opening the overview. Part-of: --- diff --git a/js/ui/panel.js b/js/ui/panel.js index 8ca5d038d..cba32416a 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -244,11 +244,8 @@ var AppMenuButton = GObject.registerClass({ }); } - _syncIcon() { - if (!this._targetApp) - return; - - let icon = this._targetApp.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN); + _syncIcon(app) { + const icon = app.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN); this._iconBox.set_child(icon); } @@ -256,7 +253,8 @@ var AppMenuButton = GObject.registerClass({ if (this._iconBox.child == null) return; - this._syncIcon(); + if (this._targetApp) + this._syncIcon(this._targetApp); } stopAnimation() { @@ -324,6 +322,8 @@ var AppMenuButton = GObject.registerClass({ this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this)); this._label.set_text(this._targetApp.get_name()); this.set_accessible_name(this._targetApp.get_name()); + + this._syncIcon(this._targetApp); } } @@ -343,7 +343,6 @@ var AppMenuButton = GObject.registerClass({ this.reactive = visible && !isBusy; - this._syncIcon(); this.menu.setApp(this._targetApp); this.emit('changed'); }